package com.ukao.pad.adapter;

import android.content.Context;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.mcxtzhang.commonadapter.rv.CommonAdapter;
import com.mcxtzhang.commonadapter.rv.ViewHolder;
import com.ukao.pad.R;
import com.ukao.pad.bean.AddClothingItem;
import com.ukao.pad.utils.CheckUtils;


import java.util.List;

/**
 * Created by ukaodev on 2017/6/14.
 */

public class AddClothingTwoAdapter extends CommonAdapter<AddClothingItem> {

private  boolean isSearchEnter;



    public AddClothingTwoAdapter(Context context, List<AddClothingItem> datas, int layoutId) {
        super(context, datas, layoutId);

    }

    public void  setIsSearchEnter(boolean isSearchEnter ){
            this.isSearchEnter=isSearchEnter;
    }


    @Override
    public void convert(final ViewHolder holder, AddClothingItem item) {
        TextView mTextView=holder.getView(R.id.activity_addclothing_list_item_tv);
        mTextView.setText(item.getName());
        if (!isSearchEnter){
            ImageView hook=holder.getView(R.id.hook);
            Log.d("头2进来了", "convert: "+item.isCheck());
            if (item.isCheck()){
                if (!CheckUtils.isNull(hook)){hook.setVisibility(View.VISIBLE);}
                mTextView.setBackgroundResource(R.drawable.shape_factory_blue);
                mTextView.setTextColor(mContext.getResources().getColor(R.color.white));
            }else{
                if (!CheckUtils.isNull(hook)){hook.setVisibility(View.INVISIBLE);}
                 mTextView.setBackgroundResource(R.drawable.shape_factory_wite);
                 mTextView.setTextColor(mContext.getResources().getColor(R.color.black));
            }
        }else{
            if (item.isCheck()){
                mTextView.setBackgroundColor(mContext.getResources().getColor(R.color.blue));
                mTextView.setTextColor(mContext.getResources().getColor(R.color.white));
            }else{
                mTextView.setBackgroundColor(mContext.getResources().getColor(R.color.white));
                mTextView.setTextColor(mContext.getResources().getColor(R.color.black));
            }

        }





    }






}
